﻿//********************************************************************************//
//创建日期：<创建日期，2018-2-27>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：月调整超计划确认信息Model(月调整确认页面)
//********************************************************************************//
using System;
using System.Collections.Generic;
using YXYLCommon;
using System.Data;

namespace Entity
{
    [Serializable]
    public class LHYueDuQRXX : BaseModel
    {

        public int I_SHIFOUQR { get; set; }
        public int I_SHIFOUDJ { get; set; }
        public string S_YONGHUH { get; set; }
        public string S_YONGHUM { get; set; }
        public int I_YM { get; set; }
        //public string S_YM { get}
        public int I_SYL { get; set; }
        //public string S_SYL { get; set; }
        public int I_YJH { get; set; }
       //public string S_YJH { get; set; }
        public int I_JJJH { get; set; }
        //public string S_JJJH { get; set; }
        public int I_SYJH { get; set; }
        //public string S_SYJH { get; set; }
        public int I_CYL { get; set; }
        //public string S_CYL { get; set; }
        public int I_JJL { get; set; }
        //public string S_JJL { get; set; }
        public decimal N_CYJE { get; set; }
        public string S_CYJE { get { return N_CYJE.ToString("0.00"); } }
        public DbDateTime D_CAOZUORQ { get; set; }
        public string S_CAOZUOR { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.I_CYL = row.Table.Columns.Contains("I_CYL") ? Convert.ToInt32(row["I_CYL"]) : 0;
            this.I_JJJH = row.Table.Columns.Contains("I_JJJH") ? Convert.ToInt32(row["I_JJJH"]) : 0;
            this.I_JJL = row.Table.Columns.Contains("I_JJL") && !Convert.IsDBNull(row["I_JJL"]) ? Convert.ToInt32(row["I_JJL"]) : 0;
            this.I_SHIFOUQR = row.Table.Columns.Contains("I_SHIFOUQR") ? Convert.ToInt32(row["I_SHIFOUQR"]) : -1;
            this.I_SHIFOUDJ = row.Table.Columns.Contains("I_SHIFOUDJ") ? Convert.ToInt32(row["I_SHIFOUDJ"]) : -1;
            this.I_SYJH = row.Table.Columns.Contains("I_SYJH") ? Convert.ToInt32(row["I_SYJH"]) : 0;
            this.I_SYL = row.Table.Columns.Contains("I_SYL") ? Convert.ToInt32(row["I_SYL"]) : 0;
            this.I_YJH = row.Table.Columns.Contains("I_YJH") ? Convert.ToInt32(row["I_YJH"]) : 0;
            this.I_YM = row.Table.Columns.Contains("I_YM") ? Convert.ToInt32(row["I_YM"]) : 0;

            this.N_CYJE = row.Table.Columns.Contains("N_CYJE") ? Convert.ToDecimal(row["N_CYJE"]) : 0;

            this.S_CAOZUOR = row.Table.Columns.Contains("S_CAOZUOR") ? Convert.ToString(row["S_CAOZUOR"]) : null;
            //this.S_CYJE = row.Table.Columns.Contains("S_CYJE") ? Convert.ToString(row["S_CYJE"]) : null;
            //this.S_CYL = row.Table.Columns.Contains("S_CYL") ? Convert.ToString(row["S_CYL"]) : null;
            //this.S_SYL = row.Table.Columns.Contains("S_SYL") ? Convert.ToString(row["S_SYL"]) : null;
            //this.S_YJH = row.Table.Columns.Contains("S_YJH") ? Convert.ToString(row["S_YJH"]) : null;
            //this.S_YM = row.Table.Columns.Contains("S_YM") ? Convert.ToString(row["S_YM"]) : null;
            this.S_YONGHUH = row.Table.Columns.Contains("S_YONGHUH") ? Convert.ToString(row["S_YONGHUH"]) : null;
            this.S_YONGHUM = row.Table.Columns.Contains("S_YONGHUM") ? Convert.ToString(row["S_YONGHUM"]) : null;

            this.D_CAOZUORQ = row.Table.Columns.Contains("D_CAOZUORQ") ? DbDateTime.Parse(row["D_CAOZUORQ"]) : DbDateTime.Parse(null);
            return this;
        }
    }
    public class DALLHYueDuQRXX : BaseDAL
    {
        protected override void fillSaveProc(BaseModel model)
        {

        }
        
        /// <summary>
        /// 获取月度确认信息列表
        /// </summary>
        public List<LHYueDuQRXX> ListGet(string yhh,int userid)
        {
            dbProc.Init("P_YSLH_YUEDUQRXXLIST");
            dbProc.AddParameter("V_YONGHUH", yhh);
            dbProc.AddParameter("V_USERID", userid);
            return CommonService.Ini().GetList<LHYueDuQRXX>(dbProc);
        }


        public DbCmdResult ListQR(string yhhs,string jjls,int userid)
        {
            dbProc.Init("P_YSLH_YUEDUQRXXLISTQR");
            dbProc.AddParameter("V_YONGHUHS", yhhs);
            dbProc.AddParameter("V_JJLS", jjls);
            dbProc.AddParameter("V_USERID", userid);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
        public DbCmdResult ListQX(string yhhs)
        {
            dbProc.Init("P_YSLH_YUEDUQRXXLISTQX");
            dbProc.AddParameter("V_YONGHUHS", yhhs);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
        /// <summary>
        /// 获取月度登记信息列表
        /// </summary>
        public List<LHYueDuQRXX> DJXXList(string yhh,int ym,int userid)
        {
            dbProc.Init("P_YSLH_YUEDUDJXXLIST");
            dbProc.AddParameter("V_YONGHUH", yhh);
            dbProc.AddParameter("V_YM", ym);
            dbProc.AddParameter("V_USERID", userid);
            return CommonService.Ini().GetList<LHYueDuQRXX>(dbProc);
        }
    }

}